function getCode() {
    var customerPhone = $("#customerPhone").val();
    if(customerPhone == "" || customerPhone == undefined){
        alert("请输入手机号！");
        return false
    }
    $.ajax({
        url: Feng.ctxPath + "/integralMallWeixin/getCode",
        type: "post",
        data: {
            "customerPhone": customerPhone
        },
        success: function (data) {
            Feng.success('获取成功!');
            $("#codeValues").val(data.split(",")[0]);
        },
        error: function (data) {
            alert('系统错误，获取失败!');
        }
    })
}

function codeSend() {
    var customerPhone = $("#customerPhone").val();
    var codeValues = $("#codeValues").val();
    var code = $("#code").val();
    var openId = $("#openId").val();
    if(code==null ||code==""){
        alert("请输入验证码！");
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/integralMallWeixin/codeSend",
        type: "post",
        data: {
            "customerPhone": customerPhone,
            "code":code,
            "codeValues":codeValues,
            "openId":openId
        },
        success: function (data) {
            if(data==0){
                alert("验证码不正确，请重新输入");
            }else if(data==1){
                alert("手机号码已经存在");
            }else{
                Feng.success('提交成功!');
            }
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
        }
    })
}

function close() {
    parent.layer.close(parent.layer.getFrameIndex(window.name))
}